package cn.mxz.service.impl;

import cn.mxz.mapper.CategoryMapper;
import cn.mxz.pojo.Category;
import cn.mxz.pojo.ResultData;
import cn.mxz.service.CategoryService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 作者；朱洪旭
 * 时间；2021/12/3 11:02
 */
@Service
public class CategoryServiceImpl implements CategoryService {
    @Autowired
    private CategoryMapper categoryMapper;
    @Override
    public ResultData selectLevel1(Integer parentid) {
        //查询level为一的
        QueryWrapper queryWrapper=new QueryWrapper();
        queryWrapper.eq("parent_id",parentid);
        List<Category> categorylist = categoryMapper.selectList(queryWrapper);
        if(categorylist!=null){
            return  new ResultData(104,"成功",categorylist);
        }
        return  new ResultData(105,"暂无数据查询异常");
    }
}
